#include "stdafx.h"
#include "GetTextExtentEditSession.h"


CGetTextExtentEditSession::CGetTextExtentEditSession(
	CTextService *pTextService, ITfContext *pContext, ITfContextView *pContextView, ITfRange *pRangeComposition, CCandidateWindow *pCandidateWindow)
	:CEditSessionBase(pTextService, pContext)
{
	_pContextView = pContextView;
        _pRangeComposition = pRangeComposition;
        _pCandidateWindow = pCandidateWindow;
}


CGetTextExtentEditSession::~CGetTextExtentEditSession(void)
{
}

//+---------------------------------------------------------------------------
//
// DoEditSession
//
//----------------------------------------------------------------------------

STDAPI CGetTextExtentEditSession::DoEditSession(TfEditCookie ec)
{
    RECT rc;
    BOOL fClipped;

    if (SUCCEEDED(_pContextView->GetTextExt(ec, _pRangeComposition, &rc, &fClipped)))
        _pCandidateWindow->_Move(rc.left, rc.bottom);
    return S_OK;
}